package jobhunter.service;

import jobhunter.model.User;
import jobhunter.repository.UserRepository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

@Service
@Transactional
public class UserService 
{

	@Autowired
	private UserRepository userRepository;
	public void add(String login,String password)
	{
		User user = new User(login, password);
		userRepository.persist(user);
		ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
	//	HttpSession session = attr.getRequest().getSession();
	//	session.setAttribute("user", user);
	}
	
	
}
